

<!DOCTYPE html>
<html lang="zh-CN" data-default-color-scheme=auto>



<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/img/fluid.png">
  <link rel="icon" href="/img/fluid.png">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="author" content="John Doe">
  <meta name="keywords" content="">
  
    <meta name="description" content="解决方式是参考网上其他的文章的，由于有很多雷同的内容，分不清原作者，这里就不贴来源了  运行版本： JQuery 3.6.0 查看源码： jquery.js 123456789101112131415161718192021222324252627282930313233343536jQuery.fn.extend( &amp;#123;	serialize: function() &amp;#123;		re">
<meta property="og:type" content="article">
<meta property="og:title" content="BUG已解决 _ 使用JQuery的serialize序列化表单时，无法获取到表单内未选中单_多选框的内容 _ 手动编写一个加强版的serialize方法获取">
<meta property="og:url" content="http://example.com/2022/02/23/BUG%E5%B7%B2%E8%A7%A3%E5%86%B3%20_%20%E4%BD%BF%E7%94%A8JQuery%E7%9A%84serialize%E5%BA%8F%E5%88%97%E5%8C%96%E8%A1%A8%E5%8D%95%E6%97%B6%EF%BC%8C%E6%97%A0%E6%B3%95%E8%8E%B7%E5%8F%96%E5%88%B0%E8%A1%A8%E5%8D%95%E5%86%85%E6%9C%AA%E9%80%89%E4%B8%AD%E5%8D%95_%E5%A4%9A%E9%80%89%E6%A1%86%E7%9A%84%E5%86%85%E5%AE%B9%20_%20%E6%89%8B%E5%8A%A8%E7%BC%96%E5%86%99%E4%B8%80%E4%B8%AA%E5%8A%A0%E5%BC%BA%E7%89%88%E7%9A%84serialize%E6%96%B9%E6%B3%95%E8%8E%B7%E5%8F%96/index.html">
<meta property="og:site_name" content="Hexo">
<meta property="og:description" content="解决方式是参考网上其他的文章的，由于有很多雷同的内容，分不清原作者，这里就不贴来源了  运行版本： JQuery 3.6.0 查看源码： jquery.js 123456789101112131415161718192021222324252627282930313233343536jQuery.fn.extend( &amp;#123;	serialize: function() &amp;#123;		re">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2022-02-23T01:58:15.000Z">
<meta property="article:modified_time" content="2022-08-22T15:42:41.107Z">
<meta property="article:author" content="John Doe">
<meta property="article:tag" content="BUG记录">
<meta name="twitter:card" content="summary_large_image">
  
  
  
  <title>BUG已解决 _ 使用JQuery的serialize序列化表单时，无法获取到表单内未选中单_多选框的内容 _ 手动编写一个加强版的serialize方法获取 - Hexo</title>

  <link  rel="stylesheet" href="https://lib.baomitu.com/twitter-bootstrap/4.6.1/css/bootstrap.min.css" />



  <link  rel="stylesheet" href="https://lib.baomitu.com/github-markdown-css/4.0.0/github-markdown.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/hint.css/2.7.0/hint.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.css" />



<!-- 主题依赖的图标库，不要自行修改 -->
<!-- Do not modify the link that theme dependent icons -->

<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_hj8rtnfg7um.css">



<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_lbnruvf0jn.css">


<link  rel="stylesheet" href="/css/main.css" />


  <link id="highlight-css" rel="stylesheet" href="/css/highlight.css" />
  
    <link id="highlight-css-dark" rel="stylesheet" href="/css/highlight-dark.css" />
  




  <script id="fluid-configs">
    var Fluid = window.Fluid || {};
    Fluid.ctx = Object.assign({}, Fluid.ctx)
    var CONFIG = {"hostname":"example.com","root":"/","version":"1.9.2","typing":{"enable":true,"typeSpeed":70,"cursorChar":"_","loop":false,"scope":[]},"anchorjs":{"enable":true,"element":"h1,h2,h3,h4,h5,h6","placement":"left","visible":"hover","icon":""},"progressbar":{"enable":true,"height_px":3,"color":"#29d","options":{"showSpinner":false,"trickleSpeed":100}},"code_language":{"enable":true,"default":"TEXT"},"copy_btn":true,"image_caption":{"enable":true},"image_zoom":{"enable":true,"img_url_replace":["",""]},"toc":{"enable":true,"placement":"right","headingSelector":"h1,h2,h3,h4,h5,h6","collapseDepth":0},"lazyload":{"enable":true,"loading_img":"/img/loading.gif","onlypost":false,"offset_factor":2},"web_analytics":{"enable":false,"follow_dnt":true,"baidu":null,"google":null,"gtag":null,"tencent":{"sid":null,"cid":null},"woyaola":null,"cnzz":null,"leancloud":{"app_id":null,"app_key":null,"server_url":null,"path":"window.location.pathname","ignore_local":false}},"search_path":"/local-search.xml"};

    if (CONFIG.web_analytics.follow_dnt) {
      var dntVal = navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack;
      Fluid.ctx.dnt = dntVal && (dntVal.startsWith('1') || dntVal.startsWith('yes') || dntVal.startsWith('on'));
    }
  </script>
  <script  src="/js/utils.js" ></script>
  <script  src="/js/color-schema.js" ></script>
  


  
<meta name="generator" content="Hexo 6.2.0"></head>


<body>
  

  <header>
    

<div class="header-inner" style="height: 70vh;">
  <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand" href="/">
      <strong>尤 Ni&#39;s Blog</strong>
    </a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/">
                <i class="iconfont icon-home-fill"></i>
                首页
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/archives/">
                <i class="iconfont icon-archive-fill"></i>
                归档
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/categories/">
                <i class="iconfont icon-category-fill"></i>
                分类
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/tags/">
                <i class="iconfont icon-tags-fill"></i>
                标签
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/about/">
                <i class="iconfont icon-user-fill"></i>
                关于
              </a>
            </li>
          
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" target="_self" href="javascript:;" data-toggle="modal" data-target="#modalSearch" aria-label="Search">
              &nbsp;<i class="iconfont icon-search"></i>&nbsp;
            </a>
          </li>
          
        
        
          <li class="nav-item" id="color-toggle-btn">
            <a class="nav-link" target="_self" href="javascript:;" aria-label="Color Toggle">&nbsp;<i
                class="iconfont icon-dark" id="color-toggle-icon"></i>&nbsp;</a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

  

<div id="banner" class="banner" parallax=true
     style="background: url('/img/default.png') no-repeat center center; background-size: cover;">
  <div class="full-bg-img">
    <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
      <div class="banner-text text-center fade-in-up">
        <div class="h2">
          
            <span id="subtitle" data-typed-text="BUG已解决 _ 使用JQuery的serialize序列化表单时，无法获取到表单内未选中单_多选框的内容 _ 手动编写一个加强版的serialize方法获取"></span>
          
        </div>

        
          
  <div class="mt-3">
    
      <span class="post-meta mr-2">
        <i class="iconfont icon-author" aria-hidden="true"></i>
        John Doe
      </span>
    
    
      <span class="post-meta">
        <i class="iconfont icon-date-fill" aria-hidden="true"></i>
        <time datetime="2022-02-23 09:58" pubdate>
          2022年2月23日 上午
        </time>
      </span>
    
  </div>

  <div class="mt-1">
    
      <span class="post-meta mr-2">
        <i class="iconfont icon-chart"></i>
        
          1.7k 字
        
      </span>
    

    
      <span class="post-meta mr-2">
        <i class="iconfont icon-clock-fill"></i>
        
        
        
          15 分钟
        
      </span>
    

    
    
  </div>


        
      </div>

      
    </div>
  </div>
</div>

</div>

  </header>

  <main>
    
      

<div class="container-fluid nopadding-x">
  <div class="row nomargin-x">
    <div class="side-col d-none d-lg-block col-lg-2">
      

    </div>

    <div class="col-lg-8 nopadding-x-md">
      <div class="container nopadding-x-md" id="board-ctn">
        <div id="board">
          <article class="post-content mx-auto">
            <!-- SEO header -->
            <h1 style="display: none">BUG已解决 _ 使用JQuery的serialize序列化表单时，无法获取到表单内未选中单_多选框的内容 _ 手动编写一个加强版的serialize方法获取</h1>
            
              <p class="note note-info">
                
                  
                    本文最后更新于：1 小时前
                  
                
              </p>
            
            
              <div class="markdown-body">
                
                <blockquote>
<p>解决方式是参考网上其他的文章的，由于有很多雷同的内容，分不清原作者，这里就不贴来源了</p>
</blockquote>
<p><strong>运行版本：</strong> JQuery 3.6.0</p>
<p><strong>查看源码：</strong> <code>jquery.js</code></p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br></pre></td><td class="code"><pre><code class="hljs javascript">jQuery.<span class="hljs-property">fn</span>.<span class="hljs-title function_">extend</span>( &#123;<br>	<span class="hljs-attr">serialize</span>: <span class="hljs-keyword">function</span>(<span class="hljs-params"></span>) &#123;<br>		<span class="hljs-keyword">return</span> jQuery.<span class="hljs-title function_">param</span>( <span class="hljs-variable language_">this</span>.<span class="hljs-title function_">serializeArray</span>() );<br>	&#125;,<br>	<span class="hljs-attr">serializeArray</span>: <span class="hljs-keyword">function</span>(<span class="hljs-params"></span>) &#123;<br>		<span class="hljs-keyword">return</span> <span class="hljs-variable language_">this</span>.<span class="hljs-title function_">map</span>( <span class="hljs-keyword">function</span>(<span class="hljs-params"></span>) &#123;<br><br>			<span class="hljs-comment">// Can add propHook for &quot;elements&quot; to filter or add form elements</span><br>			<span class="hljs-keyword">var</span> elements = jQuery.<span class="hljs-title function_">prop</span>( <span class="hljs-variable language_">this</span>, <span class="hljs-string">&quot;elements&quot;</span> );<br>			<span class="hljs-keyword">return</span> elements ? jQuery.<span class="hljs-title function_">makeArray</span>( elements ) : <span class="hljs-variable language_">this</span>;<br>		&#125; )<br>		.<span class="hljs-title function_">filter</span>( <span class="hljs-keyword">function</span>(<span class="hljs-params"></span>) &#123;<br>			<span class="hljs-keyword">var</span> type = <span class="hljs-variable language_">this</span>.<span class="hljs-property">type</span>;<br><br>			<span class="hljs-comment">// Use .is( &quot;:disabled&quot; ) so that fieldset[disabled] works</span><br>			<span class="hljs-keyword">return</span> <span class="hljs-variable language_">this</span>.<span class="hljs-property">name</span> &amp;&amp; !<span class="hljs-title function_">jQuery</span>( <span class="hljs-variable language_">this</span> ).<span class="hljs-title function_">is</span>( <span class="hljs-string">&quot;:disabled&quot;</span> ) &amp;&amp;<br>				rsubmittable.<span class="hljs-title function_">test</span>( <span class="hljs-variable language_">this</span>.<span class="hljs-property">nodeName</span> ) &amp;&amp; !rsubmitterTypes.<span class="hljs-title function_">test</span>( type ) &amp;&amp;<br>				( <span class="hljs-variable language_">this</span>.<span class="hljs-property">checked</span> || !rcheckableType.<span class="hljs-title function_">test</span>( type ) );<br>		&#125; )<br>		.<span class="hljs-title function_">map</span>( <span class="hljs-keyword">function</span>(<span class="hljs-params"> i, elem </span>) &#123;<br>			<span class="hljs-keyword">var</span> val = <span class="hljs-title function_">jQuery</span>( <span class="hljs-variable language_">this</span> ).<span class="hljs-title function_">val</span>();<br><br>			<span class="hljs-keyword">if</span> ( val == <span class="hljs-literal">null</span> ) &#123;<br>				<span class="hljs-keyword">return</span> <span class="hljs-literal">null</span>;<br>			&#125;<br><br>			<span class="hljs-keyword">if</span> ( <span class="hljs-title class_">Array</span>.<span class="hljs-title function_">isArray</span>( val ) ) &#123;<br>				<span class="hljs-keyword">return</span> jQuery.<span class="hljs-title function_">map</span>( val, <span class="hljs-keyword">function</span>(<span class="hljs-params"> val </span>) &#123;<br>					<span class="hljs-keyword">return</span> &#123; <span class="hljs-attr">name</span>: elem.<span class="hljs-property">name</span>, <span class="hljs-attr">value</span>: val.<span class="hljs-title function_">replace</span>( rCRLF, <span class="hljs-string">&quot;\r\n&quot;</span> ) &#125;;<br>				&#125; );<br>			&#125;<br><br>			<span class="hljs-keyword">return</span> &#123; <span class="hljs-attr">name</span>: elem.<span class="hljs-property">name</span>, <span class="hljs-attr">value</span>: val.<span class="hljs-title function_">replace</span>( rCRLF, <span class="hljs-string">&quot;\r\n&quot;</span> ) &#125;;<br>		&#125; ).<span class="hljs-title function_">get</span>();<br>	&#125;<br>&#125; );<br></code></pre></td></tr></table></figure>

<p><strong>简要分析：</strong> 源码中，<code>serialize()</code>方法里本质上调用了<code>serializeArray()</code>方法，可以看到它过滤了带有<code>disabled</code>属性的input标签，同时缺少对未选中的单选框、多选框的处理，那么在此方法基础上，可以手动添加相关的处理。</p>
<p><strong>加强方法：</strong></p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><code class="hljs javascript">$.fn.<span class="hljs-property">serialize_plus</span> = <span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) &#123;<br>    <span class="hljs-keyword">var</span> a = <span class="hljs-variable language_">this</span>.<span class="hljs-title function_">serializeArray</span>();<br>    <span class="hljs-keyword">var</span> $input= $(<span class="hljs-string">&#x27;input[type=radio],input[type=checkbox]&#x27;</span>, <span class="hljs-variable language_">this</span>);<br>    <span class="hljs-keyword">var</span> temp = &#123;&#125;;<br>    $.<span class="hljs-title function_">each</span>($input, <span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) &#123;<br>        <span class="hljs-keyword">if</span> (!temp.<span class="hljs-title function_">hasOwnProperty</span>(<span class="hljs-variable language_">this</span>.<span class="hljs-property">name</span>)) &#123;<br>            <span class="hljs-keyword">if</span> ($(<span class="hljs-string">&quot;input[name=&#x27;&quot;</span> + <span class="hljs-variable language_">this</span>.<span class="hljs-property">name</span> + <span class="hljs-string">&quot;&#x27;]:checked&quot;</span>).<span class="hljs-property">length</span> == <span class="hljs-number">0</span>) &#123;<br>                temp[<span class="hljs-variable language_">this</span>.<span class="hljs-property">name</span>] = <span class="hljs-string">&quot;&quot;</span>;<br>                a.<span class="hljs-title function_">push</span>(&#123;<span class="hljs-attr">name</span>: <span class="hljs-variable language_">this</span>.<span class="hljs-property">name</span>, <span class="hljs-attr">value</span>:<span class="hljs-number">0</span>&#125;);<br>            &#125;<br>        &#125;<br>    &#125;);<br>    <span class="hljs-keyword">return</span> jQuery.<span class="hljs-title function_">param</span>(a);<br>&#125;;<br></code></pre></td></tr></table></figure>
<p><strong>使用方法：</strong></p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs javascript">$(<span class="hljs-string">&#x27;#myForm&#x27;</span>).<span class="hljs-title function_">serialize_plus</span>()<br></code></pre></td></tr></table></figure>

                
              </div>
            
            <hr/>
            <div>
              <div class="post-metas my-3">
  
    <div class="post-meta mr-3 d-flex align-items-center">
      <i class="iconfont icon-category"></i>
      

<span class="category-chains">
  
  
    
      <span class="category-chain">
        
  <a href="/categories/BUG%E8%AE%B0%E5%BD%95/" class="category-chain-item">BUG记录</a>
  
  

      </span>
    
  
</span>

    </div>
  
  
    <div class="post-meta">
      <i class="iconfont icon-tags"></i>
      
        <a href="/tags/BUG%E8%AE%B0%E5%BD%95/">#BUG记录</a>
      
    </div>
  
</div>


              
  

  <div class="license-box my-3">
    <div class="license-title">
      <div>BUG已解决 _ 使用JQuery的serialize序列化表单时，无法获取到表单内未选中单_多选框的内容 _ 手动编写一个加强版的serialize方法获取</div>
      <div>http://example.com/2022/02/23/BUG已解决 _ 使用JQuery的serialize序列化表单时，无法获取到表单内未选中单_多选框的内容 _ 手动编写一个加强版的serialize方法获取/</div>
    </div>
    <div class="license-meta">
      
        <div class="license-meta-item">
          <div>作者</div>
          <div>John Doe</div>
        </div>
      
      
        <div class="license-meta-item license-meta-date">
          <div>发布于</div>
          <div>2022年2月23日</div>
        </div>
      
      
      <div class="license-meta-item">
        <div>许可协议</div>
        <div>
          
            
            
              <a target="_blank" href="https://creativecommons.org/licenses/by/4.0/">
              <span class="hint--top hint--rounded" aria-label="BY - 署名">
                <i class="iconfont icon-by"></i>
              </span>
              </a>
            
          
        </div>
      </div>
    </div>
    <div class="license-icon iconfont"></div>
  </div>



              
                <div class="post-prevnext my-3">
                  <article class="post-prev col-6">
                    
                    
                      <a href="/2022/02/28/JavaFX%20%E5%AE%9E%E7%8E%B0windows%E7%89%88%E7%AE%80%E6%98%93%E7%9A%84%E7%99%BB%E5%BD%95%E8%BD%AF%E4%BB%B6%20_%20%E6%95%B4%E5%90%88%20MyBatis%20%E6%9F%A5%E8%AF%A2%E6%95%B0%E6%8D%AE%E5%BA%93%E8%B4%A6%E5%8F%B7%20_%20%E7%AA%97%E5%8F%A3%E5%88%87%E6%8D%A2%20_%20%E4%BD%BF%E7%94%A8SceneBuilder%E8%BF%9B%E8%A1%8C%E5%8F%AF%E8%A7%86%E5%8C%96%E7%BC%96%E8%BE%91%E9%A1%B5%E9%9D%A2/" title="JavaFX 实现windows版简易的登录软件 _ 整合 MyBatis 查询数据库账号 _ 窗口切换 _ 使用SceneBuilder进行可视化编辑页面">
                        <i class="iconfont icon-arrowleft"></i>
                        <span class="hidden-mobile">JavaFX 实现windows版简易的登录软件 _ 整合 MyBatis 查询数据库账号 _ 窗口切换 _ 使用SceneBuilder进行可视化编辑页面</span>
                        <span class="visible-mobile">上一篇</span>
                      </a>
                    
                  </article>
                  <article class="post-next col-6">
                    
                    
                      <a href="/2022/02/22/Web%E9%A1%B9%E7%9B%AE%E5%AE%9E%E6%88%98%20_%20%E8%B4%AD%E7%89%A9%E7%B3%BB%E7%BB%9Fv2.0%20_%20%E5%BC%80%E5%8F%91%E8%AE%B0%E5%BD%95%EF%BC%88%E5%8D%81%EF%BC%89SpringBoot%E6%95%B4%E5%90%88%E9%98%BF%E9%87%8C%E4%BA%91OSS%E5%AF%B9%E8%B1%A1%E5%AD%98%E5%82%A8%E6%9C%8D%E5%8A%A1%20_%20Web%E5%B0%86%E4%B8%8A%E4%BC%A0%E7%9A%84%E5%95%86%E5%93%81%E5%9B%BE%E7%89%87%E4%BF%9D%E5%AD%98%E5%88%B0%E9%98%BF%E9%87%8C%E4%BA%91%EF%BC%8C%E5%90%8C%E6%97%B6%E5%B0%86%E5%9C%B0%E5%9D%80%E4%BF%9D%E5%AD%98%E5%88%B0%E6%95%B0%E6%8D%AE%E5%BA%93/" title="Web项目实战 _ 购物系统v2.0 _ 开发记录（十）SpringBoot整合阿里云OSS对象存储服务 _ Web将上传的商品图片保存到阿里云，同时将地址保存到数据库">
                        <span class="hidden-mobile">Web项目实战 _ 购物系统v2.0 _ 开发记录（十）SpringBoot整合阿里云OSS对象存储服务 _ Web将上传的商品图片保存到阿里云，同时将地址保存到数据库</span>
                        <span class="visible-mobile">下一篇</span>
                        <i class="iconfont icon-arrowright"></i>
                      </a>
                    
                  </article>
                </div>
              
            </div>

            
          </article>
        </div>
      </div>
    </div>

    <div class="side-col d-none d-lg-block col-lg-2">
      
  <aside class="sidebar" style="margin-left: -1rem">
    <div id="toc">
  <p class="toc-header"><i class="iconfont icon-list"></i>&nbsp;目录</p>
  <div class="toc-body" id="toc-body"></div>
</div>



  </aside>


    </div>
  </div>
</div>





  



  



  



  



  







    

    
      <a id="scroll-top-button" aria-label="TOP" href="#" role="button">
        <i class="iconfont icon-arrowup" aria-hidden="true"></i>
      </a>
    

    
      <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">搜索</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v" for="local-search-input">关键词</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>

    

    
  </main>

  <footer>
    <div class="footer-inner">
  
    <div class="footer-content">
       <a href="https://hexo.io" target="_blank" rel="nofollow noopener"><span>Hexo</span></a> <i class="iconfont icon-love"></i> <a href="https://github.com/fluid-dev/hexo-theme-fluid" target="_blank" rel="nofollow noopener"><span>Fluid</span></a> 
    </div>
  
  
  
  
</div>

  </footer>

  <!-- Scripts -->
  
  <script  src="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.js" ></script>
  <link  rel="stylesheet" href="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.css" />

  <script>
    NProgress.configure({"showSpinner":false,"trickleSpeed":100})
    NProgress.start()
    window.addEventListener('load', function() {
      NProgress.done();
    })
  </script>


<script  src="https://lib.baomitu.com/jquery/3.6.0/jquery.min.js" ></script>
<script  src="https://lib.baomitu.com/twitter-bootstrap/4.6.1/js/bootstrap.min.js" ></script>
<script  src="/js/events.js" ></script>
<script  src="/js/plugins.js" ></script>


  <script  src="https://lib.baomitu.com/typed.js/2.0.12/typed.min.js" ></script>
  <script>
    (function (window, document) {
      var typing = Fluid.plugins.typing;
      var subtitle = document.getElementById('subtitle');
      if (!subtitle || !typing) {
        return;
      }
      var text = subtitle.getAttribute('data-typed-text');
      
        typing(text);
      
    })(window, document);
  </script>




  
    <script  src="/js/img-lazyload.js" ></script>
  




  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/tocbot/4.18.2/tocbot.min.js', function() {
    var toc = jQuery('#toc');
    if (toc.length === 0 || !window.tocbot) { return; }
    var boardCtn = jQuery('#board-ctn');
    var boardTop = boardCtn.offset().top;

    window.tocbot.init({
      tocSelector     : '#toc-body',
      contentSelector : '.markdown-body',
      headingSelector : CONFIG.toc.headingSelector || 'h1,h2,h3,h4,h5,h6',
      linkClass       : 'tocbot-link',
      activeLinkClass : 'tocbot-active-link',
      listClass       : 'tocbot-list',
      isCollapsedClass: 'tocbot-is-collapsed',
      collapsibleClass: 'tocbot-is-collapsible',
      collapseDepth   : CONFIG.toc.collapseDepth || 0,
      scrollSmooth    : true,
      headingsOffset  : -boardTop
    });
    if (toc.find('.toc-list-item').length > 0) {
      toc.css('visibility', 'visible');
    }
  });
</script>


  <script src=https://lib.baomitu.com/clipboard.js/2.0.10/clipboard.min.js></script>

  <script>Fluid.plugins.codeWidget();</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/anchor-js/4.3.1/anchor.min.js', function() {
    window.anchors.options = {
      placement: CONFIG.anchorjs.placement,
      visible  : CONFIG.anchorjs.visible
    };
    if (CONFIG.anchorjs.icon) {
      window.anchors.options.icon = CONFIG.anchorjs.icon;
    }
    var el = (CONFIG.anchorjs.element || 'h1,h2,h3,h4,h5,h6').split(',');
    var res = [];
    for (var item of el) {
      res.push('.markdown-body > ' + item.trim());
    }
    if (CONFIG.anchorjs.placement === 'left') {
      window.anchors.options.class = 'anchorjs-link-left';
    }
    window.anchors.add(res.join(', '));
  });
</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.js', function() {
    Fluid.plugins.fancyBox();
  });
</script>


  <script>Fluid.plugins.imageCaption();</script>

  <script  src="/js/local-search.js" ></script>





<!-- 主题的启动项，将它保持在最底部 -->
<!-- the boot of the theme, keep it at the bottom -->
<script  src="/js/boot.js" ></script>


  

  <noscript>
    <div class="noscript-warning">博客在允许 JavaScript 运行的环境下浏览效果更佳</div>
  </noscript>
</body>
</html>
